package io.geekidea.boot.baiwang.controller;

import io.geekidea.boot.baiwang.dto.InvoiceRequest;
import io.geekidea.boot.baiwang.dto.RecogcollectRequest;
import io.geekidea.boot.baiwang.dto.common.Result;
import io.geekidea.boot.baiwang.service.RecogcollectService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/recogcollect")
@RequiredArgsConstructor
@Slf4j
public class RecogcollectController {

    @Resource
    private RecogcollectService recogcollectService;

    /**
     * 发票查验
     * @param recogcollectRequest
     * @throws Exception
     */
    @PostMapping()
    public Result queryDataById(@RequestBody RecogcollectRequest recogcollectRequest) {
        try {
            log.info("发票查验请求参数：{}", recogcollectRequest);
            return recogcollectService.recogcollectDataByInstanceId(recogcollectRequest);
        } catch (Exception e) {
            return Result.error("发票查验异常"+e.getMessage());
        }
    }
}
